<!DOCTYPE html>
<html lang="en">

	<include file="Public:header" />
	<include file="Public:page_css" />
	<script>
	$(function(){
		
		$('#moshi_add').ajaxForm({
			beforeSubmit: checkForm, // 此方法主要是提交前执行的方法，根据需要设置
			success: complete, // 这是提交后的方法
			dataType: 'json'
		});
		
		function checkForm(){
			if( '' == $.trim($('#moshi_name').val())){
				layer.msg('模式名称不能为空', {icon: 5,time:1000}, function(index){
	 			layer.close(index);
				$('#moshi_name').focus(); 
				});
				return false;
			}

	 }
		function complete(data){
			if(data.status==1){
				layer.msg(data.info, {icon: 6,time:1000}, function(index){
	 			layer.close(index);
				window.location.href=data.url;
				});
			}else{
				layer.alert(data.info, {icon: 5,time:1000});
				return false;	
			}
		}
	 
	});
	</script>
	<body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden">
		<include file="Public:nav" />
		<div class="row wrapper border-bottom white-bg page-heading">
            <div class="col-lg-12">
                <h2>添加模式</h2>
                <ol class="breadcrumb">
                    <li>
                        <a href="{:U('Index/index')}"><i class="fa fa-home"></i> 主页</a>
                    </li>
                    <li>
                        <a>模式管理</a>
                    </li>
                    <li>
                        <strong>模式用户</strong>
                    </li>
                </ol>
            </div>              
        </div>
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-moshi_name">
						<h5>添加模式</h5>
						<div class="ibox-tools">
							<a class="collapse-link">
								<i class="fa fa-chevron-up"></i>
							</a>
						</div>
					</div>
					<div class="ibox-content">
						<form class="form-horizontal" name="moshi_add" id="moshi_add" method="post" action="__URL__/moshi_add">
				            <div class="form-group">
								<label class="col-sm-2 control-label"> 模式名称</label>
								<div class="col-sm-5">
									<input type="text" name="moshi_name" id="moshi_name" placeholder="输入模式名称"  class="form-control" />
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-2 control-label">前几周</label>
								<div class="col-sm-5">
									<input type="text" name="moshi_week1_num" id="moshi_week1_num" placeholder="前几周"  class="form-control" />
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-2 control-label">返回财富积分</label>
								<div class="col-sm-5">
									<input type="text" name="moshi_cf_jifen" id="moshi_cf_jifen" placeholder="输入返回财富积分"  class="form-control" />
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-2 control-label"> 后几周</label>
								<div class="col-sm-5">
									<input type="text" name="moshi_week2_num" id="moshi_week2_num" placeholder="输入后几周"  class="form-control" />
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-2 control-label"> 返回财富积分\消费积分</label>
								<div class="col-sm-5">
									<input type="text" name="moshi_hh_jifen" id="moshi_hh_jifen" placeholder="输入返回财富积分\消费积分"  class="form-control" />
								</div>
							</div>

                            <div class="hr-line-dashed"></div>							
							<div class="form-group">
								<label class="col-sm-2 control-label"> 状&nbsp;态</label>
								<div class="col-sm-5" style="padding-top:5px;">
                                    <input name="status" id="status" value="1" class="js-switch" type="checkbox" checked />
									<span class="lbl">&nbsp;&nbsp;默认开启</span>
								</div>
							</div>
				            <div class="hr-line-dashed"></div>
							<div class="form-group">
								<div class="col-sm-4 col-sm-offset-2">
									<button class="btn btn-primary" type="submit">保存信息</button>&nbsp;&nbsp;&nbsp;
									<a class="btn btn-danger" href="{:U('Index/index')}">取消</a>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
		<include file="Public:footer" />

		<!-- IOS开关样式配置 -->
		<script>
		var elem = document.querySelector('.js-switch');
		    var switchery = new Switchery(elem, {
		        color: '#1AB394'
		    });
		var config = {
		    '.chosen-select': {},                    
		}
		for (var selector in config) {
		    $(selector).chosen(config[selector]);
		}

		</script>

	</body>
</html>
